jQuery(document).ready(function()
{	
	
	// INITIALIZE CUFON FONT REPLACEMENT
	Cufon.replace('h1, h2, h3, h4, h5, h6, .button', { hover: 'true' });
	
	
	// INITIALIZE DROPDOWN MENU
	jQuery('.dd-menu li:has(ul) > a').addClass('dd-submenu-title').append('<span class="dd-arrow"></span>');	
	jQuery('.dd-menu li').hover(function(){	
			// HOVER IN HANDLER
	
			jQuery('ul:first', this).css({visibility: "visible",display: "none"}).slideDown(250);									
			var path_set = jQuery(this).parents('.dd-menu li').find('a:first');
			jQuery(path_set).addClass('dd-path');						
			jQuery('.dd-menu li a.dd-path').not(path_set).removeClass('dd-path');
			
		},function(){			
			// HOVER OUT HANDLER
		
			jQuery('ul:first', this).css({visibility: "hidden"});			
	});
	jQuery('.dd-menu').hover(function() {
			// HOVER IN HANDLER
			
		}, function() {			
			// HOVER OUT HANDLER
		
			jQuery('a.dd-path', this).removeClass('dd-path');			
	});
	
	
		
	// APPEND SOME EXTRA SPANS TO STYLE FANCY FRAMES CORRECTLY
	jQuery('.frame').append('<span class="helper1"></span><span class="helper2"></span>');
	
		
	// REPLACE SUBMIT BUTTONS WITH SOMETHING EASIER TO STYLE:)
	jQuery('input[type=submit]').each(function() {		
	
		var val = jQuery(this).val();
		var a = jQuery('<a class="button primary small"><span>' + val + '</span></a>');
		var input = jQuery(this);
		
		input.after(a);
		input.hide();
		
		a.click(function() {			
			input.trigger('click');
		});
	});

	
	// INITIALIZE COIN SLIDER
	jQuery('#slider.slider-coin .navigation ul li a').addClass('coin');
	jQuery('#slider.slider-coin .slides').cycle({
		fx:			'fade',
		pager:		'#slider.slider-coin .navigation ul',
		pagerAnchorBuilder: function(idx, slide) {            
            return '#slider.slider-coin .navigation ul li:eq(' + (idx) +  ') a';
        }		
	});
	
	// INITIALIZE THUMB SLIDER
	jQuery('#slider.slider-thumb .slides').cycle({
		fx:			'fade',		
		pager:		'#slider.slider-thumb .navigation ul',		
		pagerAnchorBuilder: function(idx, slide) {            
            return '#slider.slider-thumb .navigation ul li:eq(' + (idx) +  ') a';
        }		
	});	
	
	
	// INITIALIZE PRETTYPHOTO PLUGIN
	jQuery("a[rel^='prettyPhoto']").prettyPhoto();	
	
	
	
	// -----------------------------------------------------------------------------------------
	// Internet Explorer doesn't understand some CSS selectors, so we need some helpful classes
	// -----------------------------------------------------------------------------------------
	if(jQuery.browser.msie) {
		jQuery('input[type=text]').addClass('input-text');
		jQuery('input[type=password]').addClass('input-password');
		jQuery('input[type=checkbox]').addClass('input-checkbox');
		jQuery('input[type=radio]').addClass('input-radio');
		jQuery('input[type=submit]').addClass('input-submit');
		jQuery('input[type=image]').addClass('input-image');
		jQuery('input[type=file]').addClass('input-file');
		
		// IE6 doesn't understand :first-child selector
		if(parseInt(jQuery.browser.version) == 6) {			
			jQuery('.grid > div:first-child').addClass('grid-first');
			
			// PNG transparency fix for IE6
			var png_fix = '';
			png_fix += '.divider, ';
			png_fix += '#slider, #slider span.helper1, #slider span.helper2, ';
			png_fix += '#slider .navigation .coin, ';
			png_fix += '#content .hd, #content .bd, #content .ft .shadow, #content .ft .helper1, ';
			png_fix += '#subfooter';
			
			
			//DD_belatedPNG.fix(png_fix);
		}
	}
	
	   
});
